package Object;

import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.ArrayList;

/**
 * @author: wh(1835734390 @ qq.com)
 * @date: 2022/10/13 14:30
 * @description:
 * @version:
 */
public class OISDemo01 {
    public static void main(String[] args){
        try {
            FileInputStream fis=new FileInputStream("OOS.txt");
            ObjectInputStream ois=new ObjectInputStream(fis);
            Person person=(Person)ois.readObject();
            System.out.println(person.getName());
            System.out.println(person.getAge());
            System.out.println(person.getSex());
            ArrayList<String> other=person.getOther();
            for (String string : other) {
                System.out.println(string);
            }
            ois.close();
            System.out.println("反序列化成功！");
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.exit(0);
    }
}

